package org.lansir.viewpager;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;

public class LanViewPager extends ViewPager {

	private FlowIndicator mIndicator;
	
	public LanViewPager(Context context, AttributeSet attrs) {
		super(context, attrs);

	}

	public LanViewPager(Context context) {
		super(context);
	}
	
	

	public FlowIndicator getIndicator() {
		return mIndicator;
	}

	public void setIndicator(FlowIndicator mIndicator) {
		this.mIndicator = mIndicator;
		mIndicator.setViewFlow(this);
	}

	@Override
	protected void onScrollChanged(int l, int t, int oldl, int oldt) {
		// TODO Auto-generated method stub
		super.onScrollChanged(l, t, oldl, oldt);
		if (mIndicator != null) {
			/*
			 * The actual horizontal scroll origin does typically not match the
			 * perceived one. Therefore, we need to calculate the perceived
			 * horizontal scroll origin here, since we use a view buffer.
			 */
	
			
			mIndicator.onScrolled(this.getScrollX(), t, oldl, oldt);
		}
	}
	
}
